<?php
session_start();
ob_clean();
ob_start();
define('ROOT', $_SERVER['DOCUMENT_ROOT']);
define('DOMAIN', 'http://'.$_SERVER['HTTP_HOST']);
define('SITENAME', 'MaxMobile');
define('TEMPLATE_PATH', '/home/');
define('PATH_IMAGE_THEME', '/themes/img/');
define('services_img', '/pictures/services/');
define('cat_img', '/pictures/categories_multi/');
define('news_img', '/pictures/news/');
define('slides_img', '/pictures/slides/');
define('forms_img', '/pictures/forms/');
define('faqs_img', '/pictures/faqs/');
define('page_img', '/pictures/page_static/');
define('partner_img', '/pictures/partner/');
define('noavt', '/pictures/avatar/noavt.png');
define('noimg', '/pictures/no.jpg');
define('FACEBOOK_ADMIN', '100004609203263');
define('FACEBOOK_APP', '707486842630166');
require_once("initsession.php");
require_once(ROOT."/config/config_db.php");
require_once(ROOT."/classes/database.php");
require_once(ROOT."/classes/data_func.php");
require_once(ROOT."/classes/rewrite.php");
require_once(ROOT."/classes/generate_form.php");
require_once(ROOT."/classes/user.php");
require_once(ROOT."/classes/upload.php");
require_once(ROOT.'/classes/generate_form.php');
require_once(ROOT.'/functions/form.php');
require_once(ROOT."/functions/functions.php");
require_once(ROOT."/functions/comment_function.php");
//require_once(ROOT."/functions/access_function.php");
require_once(ROOT."/functions/form.php");
require_once(ROOT."/functions/rewrite_function.php");
require_once(ROOT."/functions/date_functions.php");
require_once(ROOT."/functions/file_functions.php");
require_once(ROOT."/functions/pagebreak.php");

$general_general_cache = ROOT.'/cache/general.cache';
if(!file_exists($general_general_cache)){
   $general_general = array();
   $general_general['site_name'] = '';
   $general_general['site_email'] = '';
   $general_general['site_timezone'] = 'Asia/Bangkok';
   $general_general['site_status'] = '1';
   $general_general['site_message'] = '';
}else {
   $general_general = json_decode(file_get_contents($general_general_cache),1);  
}
if($general_general['site_status'] == '0') {
   echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
   echo '<meta name="revisit-after" content="1 days">';
   echo "<center>";
   echo $general_general['site_message'];
   echo "</center>";
   exit();
}

$general_seo_cache = ROOT.'/cache/seo.cache';
if(!file_exists($general_seo_cache)){
   $general_seo = array();
   $general_seo['seo_title'] = 'Trang chủ';
   $general_seo['seo_description'] = '';
   $general_seo['seo_keyword'] = '';
   $general_seo['seo_robots'] = 'Index,Follow';
}else {
   $general_seo = json_decode(file_get_contents($general_seo_cache),1);
}

function _loadMod($router){
    $router = strtolower($router);
    if(file_exists(ROOT.'/home/model/'.$router.'.php'))
        require_once ROOT.'/home/model/'.$router.'.php';
}
function _loadClass($router){
    $router = strtolower($router);
    if(file_exists(ROOT.'/classes/'.$router.'.class.php'))
        require_once ROOT.'/classes/'.$router.'.class.php';
}
spl_autoload_register('_loadMod');
spl_autoload_register('_loadClass');

$general = new General();
$google_analytics = "<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-46828537-1', 'sudo.vn');
  ga('send', 'pageview');

</script>";
$facebook_script = '<meta name="DC.title" content="Hệ thống bán lẻ điện thoại Max Mobile" />
   <meta name="geo.region" content="VN-HN" />
   <meta name="geo.placename" content="Ha Noi" />
   <meta name="geo.position" content="20.999286;105.84192" />
   <meta name="ICBM" content="20.999286, 105.84192" />
   <meta property="fb:app_id" content="1516148081985308"/>';
$facebook_script .= "<script>(function() {
     var _fbq = window._fbq || (window._fbq = []);
     if (!_fbq.loaded) {
       var fbds = document.createElement('script');
       fbds.async = true;
       fbds.src = '//connect.facebook.net/en_US/fbds.js';
       var s = document.getElementsByTagName('script')[0];
       s.parentNode.insertBefore(fbds, s);
       _fbq.loaded = true;
     }
     _fbq.push(['addPixelId', '307399049453036']);
   })();
   window._fbq = window._fbq || [];
   window._fbq.push(['track', 'PixelInitialized', {}]);
   </script>";
$facebook_script .= '<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?id=307399049453036&amp;ev=PixelInitialized" /></noscript>';
$bar_active = '';
?>